<template>
  <div class="layout">
    <span class="xz-confirm-title">
      <svg-icon :iconClass="appCfg.logo" />
      {{ appCfg.name }}
    </span>

    <svg-icon iconClass="close" className="layout-close" @click="winClose"/>
    <div class="mt10">
      <div class="flex-center center">
        <svg-icon iconClass="vip" className="fs24" />
        <div class="fs16 fb ml5" style="color: #a87700">{{ text }}</div>
      </div>
      <div class="text-center fs12 color-primary mt10">加入官方用户群参与不定期抽奖活动!</div>
      <img :src="imgSrc" class="qr-img" />
    </div>
  </div>
</template>

<script setup lang="ts" name="pay">
import { ref, onMounted, watch } from "vue";
import { useRoute, useRouter } from "vue-router";
import { storeToRefs } from "pinia";
import { userAppStore } from "@/stores/user";
import { systemAppStore } from "@/stores/system";
import { invokeAPi, registerInformApi } from "@/xz-fn";
import { getWeChatImg } from "@/utils/costum";

const route = useRoute();
const router = useRouter();
const _systemAppStore_ = systemAppStore();
const _userAppStore_ = userAppStore();
const { hasLogin, token } = storeToRefs(_userAppStore_);
const { appCfg, appInfo } = storeToRefs(_systemAppStore_);
const text = ref("恭喜您成为VIP!");
const msg = ref("扫码加入VIP微信群，第一时间响应您的需求！");
if(route.query.type ==='tsb'){
  text.value = "恭喜您购买翻译币成功!"
  msg.value =  "加入官方用户群参与不定期抽奖活动!" 
}else if(route.query.type ==='renewal'){
  text.value = "恭喜您续费成功!"
}

const imgSrc = ref(getWeChatImg());
invokeAPi("xz_page_load_finished", "XZDesktopOrderVIPSuccess");
invokeAPi("jsMsg_SetWindowSize", 394, 334);
onMounted(() => {
  setTimeout(() => {
    invokeAPi("jsMsg_SetWndDragPos", [
      {
        left: 0,
        top: 0,
        right: window.innerWidth - 52,
        bottom: 50
      }
    ]);
  }, 500);
});
function winClose() {
  invokeAPi("jsMsg_SetWndStatus", 0, true);
}
</script>

<style lang="scss" scoped>
.layout {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 20px);
  background: url(~@/assets/images/bg2.png) top center / 100% auto no-repeat
  #fff;
  background-color: #fff;
  padding: 16px;
  border-radius: 10px;
  box-shadow: 0px 4px 10px 0px rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(0, 0, 0, 0.1);
  position: relative;
}
.layout-close{
  position: absolute;
  right: 12px;
  top: 12px;
  font-size: 24px;
  cursor: pointer;
}
.qr-img {
  display: block;
  width: 150px;
  height: 150px;
  margin: 20px auto;
}
</style>
<style lang="scss">
#app{
  padding: 10px;
}
</style>
